package com.koron.common.web.mapper;

import com.koron.common.bean.query.StaffQueryBean;
import com.koron.common.web.bean.StaffBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;

@EnvSource("_default")
public interface StaffMapper {

	public StaffBean getStaff(String loginid);

	public StaffBean getStaffByCode(@Param("code") String code);

	public List<StaffBean> selectList(StaffQueryBean query);

	/**
	 * 删除所有的员工信息
	 * @return
	 */
	@Delete("DELETE FROM tblstaff")
	public int deleteAll();

	/**
	 * 批量插入员工信息
	 * @param list
	 * @return
	 */
	public int batchInsertStaff(List<StaffBean> list);

	/**
	 * 批量插入员工部门信息
	 * @param list
	 * @return
	 */
	public int batchInsertStaffDepartment(List<StaffBean> list);

	/**
	 * 获取所有用户信息
	 * @return
	 */
	@Select("SELECT tb.id AS id,tb.name AS name,tb.code AS code,tb.departmentid AS departmentid,tb.position AS position, " +
			"tb.phone AS phone,tb.mobile AS mobile,tb.email AS email,tb.sex AS sex,tb.idcard AS idcard, " +
			"tb.status AS status,tb.loginid AS account,tb.weighting AS weighting,tb.photourl AS photourl,tb.openid AS openid, " +
			"tb.userid AS userid " +
			"FROM tblstaff tb")
	List<StaffBean> getAllStaff();
}
